
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link href="assets/css/bootstrap.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="css/style.css"/>
    <link href="assets/css/codemirror.css" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/ace.min.css"/>
    <link rel="stylesheet" href="font/css/font-awesome.min.css"/>
    <!--[if lte IE 8]>
    <link rel="stylesheet" href="assets/css/ace-ie.min.css"/>
    <![endif]-->
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/typeahead-bs2.min.js"></script>
    <script src="assets/js/jquery.dataTables.min.js"></script>
    <script src="assets/js/jquery.dataTables.bootstrap.js"></script>
    <script src="assets/layer/layer.js" type="text/javascript"></script>
    <script src="assets/laydate/laydate.js" type="text/javascript"></script>
    <script src="js/dragDivResize.js" type="text/javascript"></script>
    <title>添加权限</title>
</head>

<body>
<div class="Competence_add_style clearfix">

    <div class="title_name">修改管理员</div>
    <form action="updateManager" method="post">

        <input type="hidden" value="${managerVo.mgrId}" name="mgrId">
        <div class="Competence_add" style="padding:20px;">

            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                用户名： </label>
                <div class="col-sm-9"><input type="text" id="form-field-1" placeholder="" name="loginName"
                                             value="${managerVo.loginName}"
                                             class="col-xs-10 col-sm-5"></div>
            </div>

            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                密码： </label>
                <div class="col-sm-9"><input type="text" id="form-field-1" placeholder="" name="loginPwd"
                                             value="${managerVo.loginPwd}"
                                             class="col-xs-10 col-sm-5"></div>
            </div>

            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                姓名： </label>
                <div class="col-sm-9"><input type="text" id="form-field-1" placeholder="" name="mgrName"
                                             value="${managerVo.mgrName}"
                                             class="col-xs-10 col-sm-5"></div>
            </div>

            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                性别： </label>
                <div class="col-sm-9">
                    <input type="radio" id="form-field-1" placeholder="" value="男" name="mgrGender">男&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="radio" id="form-field-1" placeholder="" value="女" name="mgrGender">女
                </div>
            </div>

            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                邮箱： </label>
                <div class="col-sm-9"><input type="text" id="form-field-1" placeholder="" name="mgrEmail"
                                             value="${managerVo.mgrEmail}"
                                             class="col-xs-10 col-sm-5"></div>
            </div>

            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                电话号码： </label>
                <div class="col-sm-9"><input type="text" id="form-field-1" placeholder="" name="mgrTel"
                                             value="${managerVo.mgrTel}"
                                             class="col-xs-10 col-sm-5"></div>
            </div>

            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                QQ： </label>
                <div class="col-sm-9"><input type="text" id="form-field-1" placeholder="" name="mgrQQ"
                                             value="${managerVo.mgrQQ}"
                                             class="col-xs-10 col-sm-5"></div>
            </div>

            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                角色名称： </label>
                <div class="col-sm-9" style="padding-left:22px;">

                    <c:forEach items="${list}" var="role">

                        <input type="radio" class="form-check-input" name="roleId" value="${role.roleId}"
                               id="exampleCheck1">
                        <label class="form-check-label" for="exampleCheck1">${role.roleName}</label>

                    </c:forEach>

                </div>
            </div>

            <!--按钮操作-->
            <div class="Button_operation">
                <button onclick="article_save_submit();" class="btn btn-primary radius" type="submit"><i
                        class="fa fa-save "></i>提交
                </button>
                <button onclick="window.history.back()" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>
<script type="text/javascript">
    //初始化宽度、高度
    $(".left_Competence_add,.Competence_add_style").height($(window).height()).val();
    ;
    $(".Assign_style").width($(window).width() - 500).height($(window).height()).val();
    $(".Select_Competence").width($(window).width() - 500).height($(window).height() - 40).val();
    //当文档窗口发生改变时 触发
    $(window).resize(function () {

        $(".Assign_style").width($(window).width() - 500).height($(window).height()).val();
        $(".Select_Competence").width($(window).width() - 500).height($(window).height() - 40).val();
        $(".left_Competence_add,.Competence_add_style").height($(window).height()).val();
        ;
    });

    /*字数限制*/
    function checkLength(which) {
        var maxChars = 200; //
        if (which.value.length > maxChars) {
            layer.open({
                icon: 2,
                title: '提示框',
                content: '您出入的字数超多限制!',
            });
            // 超过限制的字数了就将 文本框中的内容按规定的字数 截取
            which.value = which.value.substring(0, maxChars);
            return false;
        } else {
            var curr = maxChars - which.value.length; //250 减去 当前输入的
            document.getElementById("sy").innerHTML = curr.toString();
            return true;
        }
    };
    /*按钮选择*/
    $(function () {
        $(".permission-list dt input:checkbox").click(function () {
            $(this).closest("dl").find("dd input:checkbox").prop("checked", $(this).prop("checked"));
        });
        $(".permission-list2 dd input:checkbox").click(function () {
            var l = $(this).parent().parent().find("input:checked").length;
            var l2 = $(this).parents(".permission-list").find(".permission-list2 dd").find("input:checked").length;
            if ($(this).prop("checked")) {
                $(this).closest("dl").find("dt input:checkbox").prop("checked", true);
                $(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked", true);
            } else {
                if (l == 0) {
                    $(this).closest("dl").find("dt input:checkbox").prop("checked", false);
                }
                if (l2 == 0) {
                    $(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked", false);
                }
            }

        });
    });

    //回显
    var gender = '${managerVo.mgrGender}';
    $(":radio[name='mgrGender'][value='" + gender + "']").attr("checked", true);

    var roleIds = '${managerVo.roleId}';

        $(":radio[name='roleId'][value='" + roleIds + "']").attr("checked", true);



    <%--var roleId = '${roleId}';--%>
    <%--$(":checkbox[name='roleId'][value='" + roleId + "']").attr("checked", true);--%>
</script>
